package model

import "time"

type OrderModel struct {
	Id          int64     `json:"id"`
	OrderNumber string    `xorm:"varchar(128) notnull 'order_number' comment('订单号')" json:"order_number"`
	CreateAt    time.Time `xorm:"'create_at' created" json:"create_at"`
	UpdateAt    time.Time `xorm:"'update_at' updated" json:"update_at"`
	DeleteAt    time.Time `xorm:"'delete_at' deleted" json:"delete_at"`
}

func (OrderModel) TableName() string {
	return "order"
}

type CommodityModel struct {
	Id       int64     `json:"id"`
	Name     string    `xorm:"varchar(128) notnull 'name' comment('商品名字')"`
	Price    string    `xorm:"decimal(10) notnull 'price' comment('价格')"`
	Count    int64     `xorm:"notnull 'count' comment('商品数量')"`
	CreateAt time.Time `xorm:"'create_at' created" json:"create_at"`
	UpdateAt time.Time `xorm:"'update_at' updated" json:"update_at"`
	DeleteAt time.Time `xorm:"'delete_at' deleted" json:"delete_at"`
}

func (CommodityModel) TableName() string {
	return "commodity"
}

type OrderCommodityModel struct {
	Id           int64
	OrderId      int64     `xorm:"notnull 'order_id' comment('订单id')"`
	CommondityId int64     `xorm:"notnull 'commondity_id' comment('商品id')"`
	CreateAt     time.Time `xorm:"'create_at' created" json:"create_at"`
	UpdateAt     time.Time `xorm:"'update_at' updated" json:"update_at"`
	DeleteAt     time.Time `xorm:"'delete_at' deleted" json:"delete_at"`
}

func (OrderCommodityModel) TableName() string {
	return "order_commondity"
}
